#include "Camera.h"

INITIALIZE_EASYLOGGINGPP

int main() {
    using namespace std;
    cv::FileStorage config("config.yaml", cv::FileStorage::READ);
    if (!config.isOpened()) {
        LOG(ERROR) << "failed to open config file";
        exit(-1);
    }
    cv::FileNode _camera_config_node = config["camera"];
    hnurm::HKcam hk(_camera_config_node);
    hnurm::ImgInfo img;
    int cnt = 0;
    while (true) {
        bool ok = hk.SendFrame(img);
        cout << img.img.size() << img.img.empty()<< endl;
        cv::imwrite("image.jpg", img.img);
        if (cnt > 5) {
            cout << "Complete" << endl;
            break;
        }
        ++cnt;
    }

    return 0;
}
